<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../../js/babel.min.js"></script>
    <script src="../../js/react.development.js"></script>
    <script src="../../js/react-dom.development.js"></script>
</head>
<body>
    <div id="example1"></div>
    <div id="example2"></div>
</body>
</html>
<script type="text/babel">
//1. 定义组件
//方式一：工厂函数组件(简单组件:没有状态的组件)
function MyComponent() {
    return <h2>简单组件</h2>
}
ReactDOM.render(<MyComponent/>,document.getElementById('example1'))
//方式二：ES6类组件(复杂组件)
class MyComponent1 extends React.Component{
    render(){
        return <h2>复杂组件</h2>
    }
}
ReactDOM.render(<MyComponent1/>,document.getElementById('example2'))

</script>